#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        int x;
        cin >> x;
        vector<int> res;
        for (int i = 1; i * i <= x; i ++)
        {
            if(x % i == 0)
            {
                res.push_back(i);
                if(i != x / i)
                {
                    res.push_back(x / i);
                }
            }
        }
        sort(res.begin(),res.end());
        for (auto ans : res) cout << ans << " ";
        cout << endl;
    }
}
